package com.cjl.jvm.gc;

import com.cjl.designpattern.memento.actualcombat.Sys;

public class StrongRef {
    public static void collect() throws Exception{
        System.out.println("StrongRef.collect start");
        System.gc();
        System.out.println("StrongRef.collect end");
        Thread.sleep(2000);
    }
    public static void main(String[] args) throws Exception {
        System.out.println("创建强引用");
        Referred stong = new Referred(5);
        StrongRef.collect();
        System.out.println("删除强引用");
        stong.allocation1 = null;
        stong = null;
        StrongRef.collect();
        System.out.println("StrongRef.main END");
    }
}
